package com.zhihuichongcheng.application.ui.task.adapter.holder;

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.zhihuichongcheng.application.R;
import com.zhihuichongcheng.application.base.BaseActivity;
import com.zhihuichongcheng.application.bean.mine.UserBean;
import com.zhihuichongcheng.application.glide.GlideCircleTransform;

/**
 * UserHolder Created by LK on 2017/2/9.
 */
public class UserHolder extends BaseHolder {
    private ImageView userImg;
    private TextView userName;

    public UserHolder(View itemView, BaseActivity activity) {
        super(itemView, activity);
        userImg = (ImageView) itemView.findViewById(R.id.avatar);
        userName = (TextView) itemView.findViewById(R.id.name);
    }

    public void setData(final UserBean data) {
        Glide.with(getContext())
                .load(data.getLogoUrl())
                .transform(new GlideCircleTransform(getContext()))
                .placeholder(R.drawable.ic_default_avatar)
                .into(userImg);

        userName.setText(data.getUserName());
    }

}
